package com.ttg.web.controller.common;

import com.ttg.common.entities.BaseResult;
import com.ttg.common.utils.RequestParamsManager;
import com.ttg.model.dto.MctDetailDto;
import com.ttg.model.dto.MctInfoDeleteDto;
import com.ttg.model.dto.MctInfoEditDto;
import com.ttg.model.dto.MctInfoListGetDto;
import com.ttg.web.service.MctInfoService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api("商户vip信息")
@RestController
@RequestMapping("/mct")
public class MerchantInfoController {

    @Autowired
    private MctInfoService mctInfoService;

    /**
     * 积分明细 bj
     * @param data
     * @return
     */
    @PostMapping("/getMctIntegralDetail")
    public BaseResult getMctIntegralDetail(@RequestBody String data){
        MctDetailDto mctDetailDto = RequestParamsManager.transformRequestParam(data, MctDetailDto.class);
        return BaseResult.success(mctInfoService.getMctIntegralDetail(mctDetailDto));
    }

    /**
     * 分值明细 bj
     * @param data
     * @return
     */
    @PostMapping("/getMctGrowDetail")
    public BaseResult getMctGrowDetail(@RequestBody String data){
        MctDetailDto mctDetailDto = RequestParamsManager.transformRequestParam(data, MctDetailDto.class);
        return BaseResult.success(mctInfoService.getMctGrowDetail(mctDetailDto));
    }


    /**
     *会员列表 bj
     * @param data
     * @return BaseResult
     *@author zhangHongYuan
     *@date 2023/7/11 10:40
     */
    @PostMapping("/getList")
    public BaseResult getList(@RequestBody String data){
        MctInfoListGetDto mctInfoListGetDto = RequestParamsManager.transformRequestParam(data, MctInfoListGetDto.class);
        return BaseResult.success(mctInfoService.getList(mctInfoListGetDto));
    }

    /**
     *修改会员
     * @param data
     * @return BaseResult
     *@author zhangHongYuan
     *@date 2023/7/11 10:40
     */
    @PostMapping("/editMct")
    public BaseResult editMct(@RequestBody String data){
        MctInfoEditDto mctInfoEditDto = RequestParamsManager.transformRequestParam(data, MctInfoEditDto.class);
        return BaseResult.success(mctInfoService.editMct(mctInfoEditDto));
    }

    /**
     *删除会员
     * @param data
     * @return BaseResult
     *@author zhangHongYuan
     *@date 2023/7/11 10:40
     */
    @PostMapping("/deleteMct")
    public BaseResult deleteMct(@RequestBody String data){
        MctInfoDeleteDto mctInfoDeleteDto = RequestParamsManager.transformRequestParam(data, MctInfoDeleteDto.class);
        return BaseResult.success(mctInfoService.deleteMct(mctInfoDeleteDto));
    }
}
